package br.com.alugargaragem.domain.vo;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import br.com.lambdacore.lang.EqualsBuilder;
import br.com.lambdacore.lang.HashCodeBuilder;
import br.com.lambdacore.lang.ToStringBuilder;
import br.com.lambdacore.lang.annotation.EqualsHashCode;
import br.com.lambdacore.lang.annotation.ToString;

@Embeddable
public class Email {

	@ToString
	@EqualsHashCode
	@Column(nullable = false)
	private String email;

	public Email() {
	}

	public Email(String email) {
		this.setEmail(email);
	}

	@Override
	public boolean equals(Object other) {
		return EqualsBuilder.newInstance(this).equals(other);
	}

	public String getEmail() {
		return this.email;
	}

	@Override
	public int hashCode() {
		return HashCodeBuilder.newInstance(this).hashCode();
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Override
	public String toString() {
		return ToStringBuilder.newInstance(this).toString();
	}
}
